<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组转化</title>
</head>
<body>

<script>
    // let arr = [1,2,3,4,5,6,9];
    // console.log(arr.toString());
    // console.log(arr.join('#'));

    const cart = [{
        name: "Widget",
        price: 9.95
    }, {
        name: "Gadget",
        price: 22.95
    }];
    for (let i = 0;i < cart.length ;i++){
        console.log("常规便利name："+cart[i].name);
    }
    // let getname = function (goodobj) {
    //     console.log("map遍历:"+goodobj.name);
    // }
    // cart.map(getname);
    //另一种写法
    cart.map(goodobj => {
        console.log("map遍历name:"+goodobj.name);
    });
    for (let i = 0;i < cart.length ;i++){
        console.log("常规便利price："+cart[i].price);
    }
    cart.map(goodprice => {
        console.log("map遍历price:"+goodprice.price * 0.8);
    });

</script>
</body>
</html>